package com.dispatcher.common;

import java.util.Comparator;

import com.dispatcher.bean.Order;
import com.dispatcher.bean.UserOrders;

public class OrderSort {
	public UserOrdersSort getUserOrdersSort(){
		return new UserOrdersSort();
	}
	public OneOrderSort getOneOrderSort(){
		return new OneOrderSort();
	}
	public class UserOrdersSort implements Comparator<UserOrders> {

		@Override
		public int compare(UserOrders item1, UserOrders item2) {
			String object1 = item1.getOrderTime();
			String object2 = item2.getOrderTime();
			int ret = object1.compareTo(object2);
			ret=ret>0?-1:1;
			return ret;
		}
	}
	public class OneOrderSort implements Comparator<Order> {

		@Override
		public int compare(Order item1, Order item2) {
			String object1 = item1.getCreatetime();
			String object2 = item2.getCreatetime();
			int ret = object1.compareTo(object2);
			ret=ret>0?-1:1;
			return ret;
		}
	}
}
